using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace Developex.DatabaseWrapper
{
	/// <summary>
	/// interface for field
	/// </summary>
	public interface IField : IFieldBase, ICloneable
	{
		/// <summary>
		/// Get DbType
		/// </summary>
		/// <returns></returns>
		DbType? GetDbType();

		/// <summary>
		/// Get Type of Value
		/// </summary>
		/// <returns></returns>
		Type GetValueType();

		/// <summary>
		/// Get field flags
		/// </summary>
		FieldFlags Flags { get; set; }

		/// <summary>
		/// Expression used in SELECT query
		/// </summary>
		string GetSelectExpression();

		/// <summary>
		/// Set value
		/// </summary>
		/// <param name="value"></param>
		void SetValue(object value);

		/// <summary>
		/// Set value (init)
		/// </summary>
		/// <param name="value"></param>
		void InitValue(object value);

		/// <summary>
		/// Get value
		/// </summary>
		/// <returns></returns>
		object GetValue();

		/// <summary>
		/// Is value initialized
		/// </summary>
		/// <returns></returns>
		bool IsInitialized();

		/// <summary>
		/// Is value manual set
		/// </summary>
		/// <returns></returns>
		bool IsManualSet();

		/// <summary>
		/// UpdatedOn,UpdatedBy and so on
		/// </summary>
		/// <returns>true if changed</returns>
		bool SetUpdateAutoValue(Connection conn);

		/// <summary>
		/// CreatedOn,CreatedBy and so on
		/// </summary>
		/// <returns>true if changed</returns>
		bool SetCreateAutoValue(Connection conn);

		/// <summary>
		/// Check value for correctness
		/// </summary>
		/// <returns></returns>
		bool CheckValue();

		/// <summary>
		/// Compare two fields
		/// </summary>
		/// <param name="fieldToCompare"></param>
		/// <returns></returns>
		int CompareTo(IField fieldToCompare);
	}
}
